package com.caiden_micheal.dynamic.record.mapper;

import com.caiden_micheal.dynamic.process.dto.inner.UploadFileDTO;
import com.caiden_micheal.dynamic.record.domain.DFileRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DFileRecordMapper {
    void insert(String dFileName);

    void edit(@Param("fileList") List<UploadFileDTO> fileList);

    @Delete("DELETE FROM sys_dynamic_file_record WHERE file_name=#{fileName}")
    void remove(String fileName);


    @Select("SELECT * FROM sys_dynamic_file_record WHERE create_time <= #{dateTime} AND `status`=0")
    List<DFileRecord> findDeActiveFile(@Param("dateTime") String dateTime);

    void deleteDeActiveFile(@Param("deActiveFileList") List<DFileRecord> deActiveFileList);

    @Select("SELECT * FROM sys_dynamic_file_record WHERE file_name=#{fileName}")
    DFileRecord findByFileName(String fileName);
}